#!/usr/bin/env python

#
# Find the longest line in a text file
#

import sys

files = map(lambda filename: (filename, None), sys.argv[1:])
if 0 == len(files):
    files.append(("standard input", sys.stdin))


for (filename, file) in files:
    if not file:
        try:
            file = open(filename)
        except:
            sys.stderr.write("can't open file '%s' for reading." % (file))
            sys.exit(1)

    line = file.readline()

    max_length = -1
    while line:
        if line[-1] == '\n':
            this_length = len(line) - 1
        else:
            this_length = len(line)

        if max_length < this_length:
            max_length = this_length

        line = file.readline()

    print(filename + ": " + str(max_length))
